const path = require('path')
const HtmlWebPackPlugin = require('html-webpack-plugin')
module.exports = {
    mode: "development",    //模式
    entry: './src/main.ts', //入口文件
    output: {   //输出
        path: path.resolve(__dirname,"./dist"),
        filename: "bundle.js"
    },
    resolve:{   //省略后缀
        extensions: [".ts", ".tsx", ".js", ".json"]
    },
    module: {//模块
        rules: [
            { test: /\.tsx?$/, loader: "ts-loader" }    //先安装typescript和ts-loader才能生效这个配置
        ]
    },
    devServer:{ //配置本地服务  需要安装npm i webpack-dev-server -D 也可以去掉该默认项

    },
    plugins: [
        new HtmlWebPackPlugin({ //指定网页模板 需要下载 npm i html-webpack-plugin -D
            template: "./index.html"
        })
    ]
}